package cn.kgc.config;

import cn.kgc.handler.MyInterceptor;
import org.omg.PortableInterceptor.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration      //标识配置类
public class MyWebConfig implements WebMvcConfigurer {

    @Autowired
    private MyInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        //注册拦截器
//        InterceptorRegistration interceptor = registry.addInterceptor(myInterceptor);
//
//        //拦截哪些资源
//        interceptor.addPathPatterns("/**");
//
//        //放行哪些资源
//        interceptor.excludePathPatterns("/**/anchor");
    }
}
